<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <!-- P4.17 -->
    <script>
        // 星期一：吃西瓜；星期二：吃葡萄；星期三：吃辣椒；其它：吃大米
        var day = 2;
        if (day == 1) {
            console.log('西瓜');
        } else if (day == 2) {
            console.log('葡萄');
        } else if (day == 3) {
            console.log('辣椒');
        } else {
            console.log('大米&老鼠');
        }

        // if-else  -> switch-case
        // P4.18 break
        var day = 3;
        switch (day) {
            case 1:
                console.log('西瓜');
                break;
            case 2:
                console.log('葡萄');
                break;
            case 3:
                console.log('辣椒');
                break;
            default:
                console.log('大米');
                break;
        }
    </script>

</body>

</html>